Skip to content

[14.0][FIX] stock_location_flowable: split move lines on mixing MO#873

Merged
eantones merged 1 commit into14.0from
14.0-fix-stock_location_flowable-split_move_lines
Mar 27, 2026
Merged

[14.0][FIX] stock_location_flowable: split move lines on mixing MO#873
eantones merged 1 commit into14.0from
14.0-fix-stock_location_flowable-split_move_lines

Conversation

@eantones
Copy link
Copy Markdown
Member

Summary

  • Fix mixing MO creation that produced two move lines per lot (one with reservation, one with qty_done) when quant quantities had more decimal precision than the UoM rounding
  • The old code created lines with qty_done first, then relied on Odoo's _update_reserved_quantity to merge the reservation — a UoM round-trip check could fail and create a second line instead
  • The fix follows the standard Odoo pattern: reserve first via action_assign, then set qty_done on the reserved lines by matching lot_id
  • Add regression test with coarse UoM rounding that triggers the round-trip mismatch

Test plan

  • All 85 tests pass (84 existing + 1 new)
  • New test fails with old code, passes with fix (TDD validated)
  • Pre-commit clean

…lines

The mixing MO creation in _action_done created move lines with qty_done
first, then called action_assign expecting Odoo to merge the reservation
into those existing lines. This merge relies on a UoM round-trip check
in _update_reserved_quantity that fails when the quant quantity has more
decimal precision than the UoM rounding allows. When the merge fails,
a second line is created for the same lot — one with only product_uom_qty
and one with only qty_done — making the MO impossible to complete
("cannot unreserve more products than you have in stock").

The fix follows the standard Odoo pattern: call action_assign first to
create proper reservation lines, then set qty_done on those lines by
matching lot_id. This eliminates the dependency on the merge and prevents
split lines regardless of UoM rounding configuration.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 97.05882% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 50.72%. Comparing base (c0d0de9) to head (42bb39f).
⚠️ Report is 2 commits behind head on 14.0.

Files with missing lines Patch % Lines
stock_location_flowable/models/stock_picking.py 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             14.0     #873      +/-   ##
==========================================
+ Coverage   50.63%   50.72%   +0.08%     
==========================================
  Files         979      979              
  Lines       16724    16752      +28     
  Branches     3562     3566       +4     
==========================================
+ Hits         8469     8497      +28     
  Misses       8038     8038              
  Partials      217      217              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eantones eantones merged commit 7c24d82 into 14.0 Mar 27, 2026
13 checks passed
@eantones eantones deleted the 14.0-fix-stock_location_flowable-split_move_lines branch March 27, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant